<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:a="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
    
    <ui:define name="body">
        
        <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
        
        <h:form id="user" styleClass="edit">
            
            <rich:panel>
                <f:facet name="header">#{userHome.managed ? 'Edit' : 'Add'} User</f:facet>
                
                
                
                <s:decorate id="departmentDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">department</ui:define>
                    <h:inputTextarea id="department"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.department}"/>
                </s:decorate>
                
                
                <s:decorate id="emailDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">email</ui:define>
                    <h:inputTextarea id="email"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.email}"/>
                </s:decorate>
                
                
                <s:decorate id="passwordDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">password</ui:define>
                    <h:inputTextarea id="password"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.password}"/>
                </s:decorate>
                
                
                <s:decorate id="phoneDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">phone</ui:define>
                    <h:inputTextarea id="phone"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.phone}"/>
                </s:decorate>
                
                
                <s:decorate id="realNameDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">realName</ui:define>
                    <h:inputTextarea id="realName"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.realName}"/>
                </s:decorate>
                
                
                
                <s:decorate id="usernameDecoration" template="layout/edit.xhtml">
                    <ui:define name="label">username</ui:define>
                    <h:inputTextarea id="username"
                                     cols="80"
                                     rows="3"
                                     value="#{userHome.instance.username}"/>
                </s:decorate>
                
                
                <div style="clear:both">
                    <span class="required">*</span> 
                    required fields
                </div>
                
            </rich:panel>
            
            <div class="actionButtons">
                
                <h:commandButton id="save" 
                                 value="Save" 
                                 action="#{userHome.persist}"
                                 disabled="#{!userHome.wired}"
                                 rendered="#{!userHome.managed}"/>  
                
                <h:commandButton id="update" 
                                 value="Save" 
                                 action="#{userHome.update}"
                                 rendered="#{userHome.managed}"/>
                
                <h:commandButton id="delete" 
                                 value="Delete" 
                                 action="#{userHome.remove}"
                                 immediate="true"
                                 rendered="#{userHome.managed}"/>
                
                <s:button id="done" 
                          value="Done"
                          propagation="end"
                          view="/User.xhtml"
                          rendered="#{userHome.managed}"/>
                
                <s:button id="cancel" 
                          value="Cancel"
                          propagation="end"
                          view="/#{empty userFrom ? 'UserList' : userFrom}.xhtml"
                          rendered="#{!userHome.managed}"/>
                
            </div>
        </h:form>
        
    </ui:define>
    
</ui:composition>
